import React, { Component } from "react";
// 这里引入story
import story from "../story";
export default class About extends Component {
  constructor() {
    super();
    this.state = story.getState();
    this.unSubscribe = story.subscribe(() => {
      this.setState(story.getState());
    });
  }
  componentWillUnmount() {
    // 清除订阅===执行一下
    this.unSubscribe();
  }
  render() {
    const { name, theme } = this.state;
    return <div onClick={this.handleClick} style={{ background: theme }}>{name}关于</div>;
  }
}
